package com.zhengshang.api.service.impl;

import com.zhengshang.api.domain.AppGame;
import com.zhengshang.api.mapper.AppGameMapper;
import com.zhengshang.api.service.IAppGameService;
import com.zhengshang.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 游戏Service业务层处理
 * 
 * @author zhengshang
 * @date 2021-06-01
 */
@Service
public class AppGameServiceImpl implements IAppGameService
{
    @Autowired
    private AppGameMapper appGameMapper;

    /**
     * 查询游戏
     * 
     * @param bankId 游戏ID
     * @return 游戏
     */
    @Override
    public AppGame selectAppGameById(Long bankId)
    {
        return appGameMapper.selectAppGameById(bankId);
    }



    /**
     * 查询游戏列表
     * 
     * @param AppGame 游戏
     * @return 游戏
     */
    @Override
    public List<AppGame> selectAppGameList(AppGame AppGame)
    {
        return appGameMapper.selectAppGameList(AppGame);
    }

    @Override
    public List<AppGame> queryAppGameList(AppGame AppGame) {
        return appGameMapper.queryAppGameList(AppGame);
    }

    /**
     * 新增游戏
     * 
     * @param appGame 游戏
     * @return 结果
     */
    @Override
    public int insertAppGame(AppGame appGame)
    {
        appGame.setCreateTime(DateUtils.getNowDate());
        appGame.setGameState("1");
        return appGameMapper.insertAppGame(appGame);
    }

    /**
     * 修改游戏状态
     *
     * @param appGame 游戏信息
     * @return 结果
     */
    @Override
    public int updateGameState(AppGame appGame)
    {
        return appGameMapper.updateAppGame(appGame);
    }

    /**
     * 修改游戏
     * 
     * @param AppGame 游戏
     * @return 结果
     */
    @Override
    public int updateAppGame(AppGame AppGame)
    {
        AppGame.setUpdateTime(DateUtils.getNowDate());
        return appGameMapper.updateAppGame(AppGame);
    }

    /**
     * 批量删除游戏
     * 
     * @param bankIds 需要删除的游戏ID
     * @return 结果
     */
    @Override
    public int deleteAppGameByIds(Long[] bankIds)
    {
        return appGameMapper.deleteAppGameByIds(bankIds);
    }

    /**
     * 删除游戏信息
     * 
     * @param bankId 游戏ID
     * @return 结果
     */
    @Override
    public int deleteAppGameById(Long bankId)
    {
        return appGameMapper.deleteAppGameById(bankId);
    }
}
